//测试vscode如何提交项目修改文件到码云
const path = require('path');
const express = require('express');
const bodyParser = require('body-parser');
const favicon = require('serve-favicon');
const tracer = require('tracer').colorConsole();
const app = express();



//路由
var index = require('./routes/index');

app.use('/index',index);

app.use(express.static(path.join(__dirname, 'public'))); //声明public为外部可用地址 正常存放 js img css
app.set('views', path.join(__dirname, 'templates'));  //声明模板路径。
app.engine('html', ejs.renderFile);//引擎模板
app.set('view engine', 'html'); //模板后缀
app.set('view cache', false); //不启用模板缓存


//处理页面数据 
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());


//网页图标
app.use(favicon('templates/assets/image/logo.png'));

tracer.info('服务已启动', `http://127.0.0.1:8000`);


app.listen(8000);